#ifndef _EKOS_TRAP_H_
#define _EKOS_TRAP_H_

#include <global/header/types.h>

struct pushregs_s
{
     /* registers as pushed by pusha */
     GPREG_T edi;
     GPREG_T esi;
     GPREG_T ebp;
     GPREG_T esp;		/* Useless */
     GPREG_T ebx;
     GPREG_T edx;
     GPREG_T ecx;
     GPREG_T eax;
};

struct stackframe_s
{
     GPREG_T  esp;
     SREG_T   ss;
     uint16_t padding;
};

struct tf_hw_s
{
     GPREG_T  eip;
     SREG_T   cs;
     uint16_t padding3;
     EFLAGS_T eflags;
     /* below here only when crossing rings, such as from user to kernel */
     struct stackframe_s stk;
};
     
struct trapframe_s
{
     struct pushregs_s regs;

     SREG_T   es;
     uint16_t padding1;
     SREG_T   ds;
     uint16_t padding2;
     uint32_t num;
     /* below here defined by x86 hardware */
	 uint32_t err;				/* This may be pushed by asm code =_= */
	 struct tf_hw_s hw;			/* This is pushed by soft/noerr interrupt */
};

struct tf_sys_s
{
	 uint32_t eax;
	 uint32_t ebp;
	 struct tf_hw_s hw;
};

#endif /* _EKOS_TRAP_H_ */
